Skip to content

fix(targeting): make hids optional in TargetingRequest - #388

Merged
mosherBT merged 1 commit into
masterfrom
fix/targeting-optional-hids
Nov 12, 2026
Merged

mosherBT merged 1 commit into
masterfrom
fix/targeting-optional-hids

Conversation

@jrosendahl-opt

Copy link
Copy Markdown
Contributor

Why

TargetingRequest declared hids (hint identifiers) as required, so TypeScript rejected sdk.targeting({ ids: ["a"] }) even though normalizeTargetingRequest already defaults a missing hids to [] at runtime.

What Changed

  • lib/edge/targeting.ts: hids is now hids?: string[], and Targeting() reads it with req.hids?.forEach, so direct callers of the exported Targeting() that omit it don't throw.
  • lib/sdk.test.ts: the targeting test now checks that hids are sent as hid (previously untested).

How to Test

  • npx jest: all 703 tests pass.

  • npx tsc --noEmit -p lib: a call sdk.targeting({ ids: ["a"] }) fails to type-check before this change (Property 'hids' is missing) and passes after. Jest doesn't type-check and test files are excluded from tsc, so this is checked with tsc rather than a test.

  • Tested

  • Docs updated — the README's TargetingRequest section will be updated in docs: align README and addon docs with the code #387 to match.

Notes

Non-breaking: the type only gets looser. ids stays required.

  • Breaking change
  • Requires release

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jrosendahl-opt
jrosendahl-opt requested review from a team as code owners November 11, 2026 22:24
@mosherBT
mosherBT merged commit fd5a5be into master Nov 12, 2026
7 checks passed
@mosherBT
mosherBT deleted the fix/targeting-optional-hids branch November 12, 2026 14:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants